package fun.sboy.headacheMemo.util;

import lombok.Data;

@Data
public class ResultUtils {
    private Integer code;
    private String msg;
    private Object data;

    public ResultUtils() {
    }

    public ResultUtils(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResultUtils fail(String msg) {
        return get(-1, msg, null);
    }

    public static ResultUtils success(Object data) {
        return get(0, "操作成功", data);
    }

    public static ResultUtils success(String msg, Object data) {
        return get(0, msg, data);
    }

    public static ResultUtils get(Integer code, String msg, Object data) {
        return new ResultUtils(code, msg, data);
    }
}
